-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Post Content: Add some text to the Post Content block when used in a 404 context #33570
Conversation
@@ -17,6 +17,9 @@ function render_block_core_post_content( $attributes, $content, $block ) { | |||
static $seen_ids = array(); | |||
|
|||
if ( ! isset( $block->context['postId'] ) ) { | |||
if ( is_404() ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 - I don't think we should be adding hardcoded content like that. Such content should be editable and removable
. Even if we added a wrapper with a css class here, someone would have to use css to hide it.
In my head this is something to be handled in 404 template but it seems I can't understand how this is not working. For example right now that we have a 404
template in tt1-blocks
with a custom header block - we can't make this translatable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regardless of the outcome of those PRs (I'm betting on #33217), this feels best absorbed by patterns than by hard-coded server-side logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if the patterns PR merges, I think this is a very useful tool. If I want to create a simple site with only one template, this allows me to do that...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I want to create a simple site with only one template
I think this is a good aspiration for FSE. Building simple sites should feel as convenient as working with a single template. But I think the current proposal is overloading base FSE blocks with meaning and hardcoded decisions.
I disagree with the approach because I think users should be able to change everything on the 404 template by editing the template. FSE themes don't have conditionals in the same way as classic PHP based themes do, if we want to implement that, then that needs to be a complete system, not a one off for the 404 page. |
Description
Similarly to #33515, we should output some default copy on the page when the post content block is used in a 404 context. This makes the creation of 404 templates much simpler as themes can simply use the same template as their index.
How has this been tested?
Another benefit of this approach is that the default text can be translated. We might want to change the copy.
Screenshots
Types of changes
New feature (non-breaking change which adds functionality)
Checklist:
*.native.js
files for terms that need renaming or removal).